@import '../../style/themes/index.less';

@image-prefix-cls: ~'@{prefix}-image-item';
@single-upload-prefix-cls: ~'@{prefix}-single-upload';
@multi-upload-prefix-cls: ~'@{prefix}-multi-upload';

.@{image-prefix-cls} {
  position: relative;
  width: 160px;
  height: 160px;

  &-remove {
    width: 30px;
    height: 30px;
    position: absolute;
    right: 12px;
    top: 12px;
    text-align: right;
    vertical-align: top;
    z-index: 10;
    background-size: 30px;
    background-image: url(data:image/svg+xml;charset=utf-8;base64,PHN2ZyB3aWR0aD0nMTYnIGhlaWdodD0nMTYnIHZpZXdCb3g9JzAgMCAxNiAxNicgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJz48ZyBmaWxsPSdub25lJyBmaWxsLXJ1bGU9J2V2ZW5vZGQnPjxjaXJjbGUgZmlsbC1vcGFjaXR5PScuNCcgZmlsbD0nIzQwNDA0MCcgY3g9JzgnIGN5PSc4JyByPSc4Jy8+PHBhdGggZD0nTTExLjg5OCA0LjEwMWEuMzQ1LjM0NSAwIDAgMC0uNDg4IDBMOCA3LjUxMWwtMy40MTEtMy40MWEuMzQ1LjM0NSAwIDAgMC0uNDg4LjQ4OGwzLjQxMSAzLjQxLTMuNDEgMy40MTJhLjM0NS4zNDUgMCAwIDAgLjQ4OC40ODhMOCA4LjQ4N2wzLjQxMSAzLjQxMWEuMzQ1LjM0NSAwIDAgMCAuNDg4LS40ODhMOC40ODggOGwzLjQxLTMuNDEyYS4zNDQuMzQ0IDAgMCAwIDAtLjQ4N3onIGZpbGw9JyNGRkYnLz48L2c+PC9zdmc+);
  }

  &-content {
    height: 100%;
    width: 100%;
    border-radius: 6px;
    background-size: cover;
  }

  &.disable-delete {
    .@{image-prefix-cls}-remove {
      display: none;
    }
  }

  &.status-fail {
    .@{image-prefix-cls}-error {
      display: flex;
    }
  }

  &.status-uploading {
    .@{image-prefix-cls}-uploading {
      display: flex;
    }
  }

  &-error {
    display: none;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 5;
    justify-content: center;
    align-items: center;
    font-size: 60px;
    color: @error-color;
  }

  &-uploading {
    display: none;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 5;
    justify-content: center;
    align-items: center;
    font-size: 60px;
  }
}

.@{single-upload-prefix-cls} {
  position: relative;
  width: 160px;
  height: 160px;

  .weui-upload,
  .@{image-prefix-cls} {
    width: 100%;
    height: 100%;
  }

  &-uploadBtn {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    border-radius: 6px;
    border: 2px solid rgb(221, 221, 221);
    background-color: rgb(255, 255, 255);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 60px;
    color: #999;
  }
}

.@{multi-upload-prefix-cls} {
  .flexbox {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
  }

  .flexbox-item {
    flex: 1;
    position: relative;
    margin-right: 10px;

    &:last-child {
      margin-right: 0;
    }

    &:after {
      display: block;
      content: ' ';
      padding-bottom: 100%;
    }
  }

  .weui-upload,
  .@{image-prefix-cls} {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 100%;
  }

  &-uploadBtn {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    border-radius: 6px;
    border: 2px solid rgb(221, 221, 221);
    background-color: rgb(255, 255, 255);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 60px;
    color: #999;
  }
}

.upload-image-view__delete {
  padding: 24px 0 60px 0;
  text-align: center;
  font-size: 32px;
  line-height: 1.5;
  user-select: none;
  -webkit-user-select: none;
}
